<%@page import="bean.News"%>
<%@page import="dao.NewsDAO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新闻详情页</title>
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css"
	media="all" />
<style type="text/css">
.center {
	text-align: center;
}

pre {
	white-space: pre-wrap; /* css3.0 */
	white-space: -moz-pre-wrap; /* Firefox */
	white-space: -pre-wrap; /* Opera 4-6 */
	white-space: -o-pre-wrap; /* Opera 7 */
	word-wrap: break-word; /* Internet Explorer 5.5+ */
}

div img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.img-box {
	width: 50%;
	margin: 10px auto;
}
</style>
</head>
<body>
	<%
		News nowNews = (News) request.getSession().getAttribute("nowNews");
	int id = nowNews.getId();
	String title = nowNews.getTitle();
	String time = nowNews.getTime();
	String publisher = nowNews.getPublisher();
	int views = nowNews.getViews();
	String text = nowNews.getText();
	int currentPage = (int) (session.getAttribute("currentPage"));
	%>
	<div class="center">
		<h2><%=title%></h2>
		发布时间：<%=time%>&nbsp;&nbsp;发布者：<%=publisher%>&nbsp;&nbsp;浏览量：&nbsp;<%=views%>次
	</div>
	<br>
	<%
		if (nowNews.isHasImg()) {
	%>
	<div class="img-box">
		<img src="/News/ShowImg?id=<%=nowNews.getId()%>">
	</div>
	<%
		}
	%>
	<pre><%=nowNews.getText()%></pre>
	<div class="center">
		<ul class="pagination">
			<li><a href="newsList.jsp?currentPage=<%=currentPage%>">返回</a></li>
		</ul>
	</div>
	<br>
	<br>
</body>
</html>